package com.kaili.common.util;

import org.springframework.context.MessageSource;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Locale;


public class MessageUtils {

	private static MessageSource messageSource = new ClassPathXmlApplicationContext("applicationContext-common.xml");
	
	public static String getMessage(String key){
		return getMessage(key,null);
	}
	
	public static String getMessage(String key, Object params[]){
		return getMessage(key, params, LoginDetailUtils.getCurrentUserLocale());
	}
	
	public static String getMessage(String key, Object params[],Locale locale){
		return messageSource.getMessage(key,params,locale);
	}
}
